<template>
  <div>
    <ul>
      <li @click="now = i" :class="{ active: i == now }" v-for="(item, i) in items" :key="i">
        {{item}}
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        now: 0,
        items: [
          '双核i5/8GB内存/128GB闪存',
          '双核i5/8GB内存/256GB闪存',
          '定制款: 双核i5/8GB内存/128GB闪存',
          '定制款: 双核i5/8GB内存/256GB闪存',
          ],
      }
    },
  }
</script>

<style lang="scss" scoped>
ul,li{
  padding: 0;
  margin: 0;
  list-style: none;
}
ul{
  display: flex;
  flex-wrap: wrap;
  li{
    margin: 5px;
    border: 1px solid #333;
    color: gray;
    padding: 5px;
    white-space: nowrap;
    user-select: none;
      &.active{
        border-color: darkblue;
        background-color: #333;
        color: white;
      }
  }
}
</style>